//
//  itemSubCateCollectionViewCell.m
//  礼物go
//
//  Created by dllo on 16/5/27.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "itemSubCateCollectionViewCell.h"

@implementation itemSubCateCollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubviews];
        //self.dk_backgroundColorPicker = DKColorPickerWithRGB(0xFFFAFA,0xBEBEBE);
    }
    return self;
}

-(void)createSubviews{
    self.bgImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height / 5 * 4)];
    //self.bgImageView.backgroundColor = [UIColor purpleColor];
    [self.contentView addSubview:self.bgImageView];

    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.contentView.frame.size.height / 5 * 4 , self.contentView.frame.size.width, self.contentView.frame.size.height / 5)];
    //self.nameLabel.backgroundColor = [UIColor yellowColor];
    [self.contentView addSubview:self.nameLabel];
    self.nameLabel.textAlignment = NSTextAlignmentCenter;
    self.nameLabel.font = [UIFont systemFontOfSize:13];
}

-(void)layoutSubviews{
    [super layoutSubviews];
    self.bgImageView.frame = CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height / 5 * 4);
    self.nameLabel.frame = CGRectMake(0, self.contentView.frame.size.height / 5 * 4 , self.contentView.frame.size.width, self.contentView.frame.size.height / 5);
}

-(void)setSubCategoryModel:(ItemSubCategoryModel *)subCategoryModel{
    _subCategoryModel = subCategoryModel;
    [self.bgImageView sd_setImageWithURL:[NSURL URLWithString:_subCategoryModel.icon_url] placeholderImage:[UIImage imageNamed:@"picholder"]];
    self.nameLabel.text = _subCategoryModel.name;
}






@end
